import axios from 'axios'
import {gettoken} from '../utils/token'
axios.interceptors.request.use((config)=>{
    config.headers.Authorization=gettoken()
    return config
})
axios.interceptors.response.use((res)=>{
    return res;
},(err)=>{
    if(err.response.status==401){
       window.alert('token失效')
       window.location.href="/login"
    }else{
        return Promise.reject(err)
    }
})